﻿using System.Web.Script.Serialization;
using System.Xml.Serialization;
using Newtonsoft.Json;
using NHibernate;
using SharpArch.Domain.DomainModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SharpArch.NHibernate;

namespace Downloader.Framework.Core
{
    public interface IEntity
    {

    }
    public abstract class EntityBase : EntityBase<int>
    {

    }
    public abstract class EntityBase<T> : EntityWithTypedId<T>, IEntity
    {
       
        [ScriptIgnore]
        [JsonIgnore]
        [XmlIgnore]
        protected virtual ISession Session
        {
            get
            {
                string factoryKey = SessionFactoryAttribute.GetKeyFrom(this);
                return NHibernateSession.CurrentFor(factoryKey);
            }
        }
    }

}
